/**
 * Copyright (C) 2003-2008 xuesong.net
 * http://www.xuesong.net
 * Author: xuesong.net
 **/
jQuery(function() {
    jQuery("#submit").click(function() {
        var archiveId = jQuery.trim(jQuery("#archiveId").val());
        var password = jQuery.trim(jQuery("#password").val());

        if(password.length < 1) {
            return;
        }

        var params = {};
        params.archiveId = archiveId;
        params.password = password;

        jQuery.ajax({
            "type": "post",
            "url": PageContext.getContextPath() + "/note/archive/password/grant.html",
            "data": jQuery.param(params, true),
            "dataType": "json",
            "error": function() {
                alert("系统错误，请稍后再试。");
            },
            "success": function(result) {
                if(result.status == 200) {
                    window.location.reload();
                    return;
                }
                jQuery("#message").html(result.message);
            }
        });
    });
});

